<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>考试中</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta
            name="viewport"
            content="width=device-width, initial-scale=1, maximum-scale=1"
    />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <link rel="stylesheet" href="../../sdk/sdk.css" />
    <link rel="stylesheet" href="../../sdk/helper.css" />
    <link rel="stylesheet" href="../../sdk/iconfont.css" />
    <style>
        html,
        body,
        .app-wrapper {
            position: relative;
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<div id="root" class="../sdk/app-wrapper"></div>
<script src="../../sdk/sdk.js"></script>
<script type="text/javascript">
    /** 读取用于渲染界面的 JSON 文件 */
    function readTextFile(file, callback) {
        let rawFile = new XMLHttpRequest();
        rawFile.overrideMimeType("application/json");
        rawFile.open("GET", file, true);
        rawFile.onreadystatechange = function() {
            if (rawFile.readyState === 4 && rawFile.status == "200") {
                callback(rawFile.responseText);
            }
        }
        rawFile.send(null);
    }

    /** 渲染考试界面 */
    exam()
    function exam() {
        let amis = amisRequire('amis/embed');
        // 通过替换下面这个配置来生成不同页面
        readTextFile("../json/exam.json", function(text){
            let amisJSON = JSON.parse(text);
            let amisScopeX = amis.embed('#root', amisJSON);
        });

    }
</script>
</body>
</html>